package com.yy.dao;

import com.yy.domain.PatientExaminationDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

/**
 * <p>
 * 患儿检查信息表 Mapper 接口
 * </p>
 *
 * @author 姚欣宏
 * @since 2024-04-12
 */
public interface PatientExaminationMapper extends BaseMapper<PatientExaminationDO> {
    @Select("SELECT COUNT(*) FROM patient_examination WHERE examination_date = #{examinationDate}")
    int countByExaminationDate(@Param("examinationDate") Date examinationDate);

    @Select("SELECT COUNT(*) FROM patient_examination WHERE patient_registration_number = #{patientRegistrationNumber} AND contact_phone = #{contactPhone}")
    int countByPatientRegistrationNumberAndContactPhone(@Param("patientRegistrationNumber") String patientRegistrationNumber, @Param("contactPhone") String contactPhone);

    int countByPatientRegistrationNumberAndContactPhoneAndExaminationDate(
            @Param("patientRegistrationNumber") String patientRegistrationNumber,
            @Param("contactPhone") String contactPhone,
            @Param("startDate") String startDate
    );
}
